import { requestApi } from "@/utils/request";
import type { CommentsResponse, CommentsItemResponse } from "@/types/comments";

// 获取评论
export const getCommentsAPI = (article_id: string, page: number) => {
    return requestApi<CommentsResponse>({
        url: '/comments-data',
        method: 'GET',
        data: {
            article_id,
            page
        }
    })
}

// 用户评论游记
export const userCommentAPI = (article_id: string, comment_content: string) => {
    return requestApi<CommentsItemResponse>({
        url: '/comment-travel',
        method: 'POST',
        data: {
            article_id,
            comment_content
        }
    })
}

// 删除评论
export const deleteCommentAPI = (comment_id: string) => {
    return requestApi({
        url: '/comments-delete',
        method: 'GET',
        data: {
            comment_id
        }
    })
}

// 获取游记评论数据
export const getCommentsDataAPI = (article_id: string, page: number) => {
    return requestApi<CommentsResponse>({
        url: '/comments-data',
        method: 'GET',
        data: {
            article_id,
            page
        }
    })
}